<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>管理员身份认证</title>
    <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
    <meta name="author" content="Vincent Garreau"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" media="screen" href="css/style_identify.css">
    <link rel="stylesheet" type="text/css" href="css/reset.css"/>
    <style>
        #login_button {
            margin: 0;
            padding: 0;
            border: 1px solid transparent;
            outline: none;
            background-color: #1E90FF;
            cursor: pointer;
            color: #ffffff;
        }

        #login_img {
            text-align: center;
        }

        #login_img img {
            margin-top: 30px;
        }

        #validateCodeButton {
            margin-top: 10px;
            margin-left: 10px;
            border-radius: 5px;

        }
    </style>
    <link rel="stylesheet" href="plugins/elementui/index.css"/>
    <script src="js/jquery.min.js"></script>
    <script src="js/healthmobile.js"></script>
    <script src="js/vue.js"></script>
    <script src="js/axios-0.18.0.js"></script>
    <script src="plugins/elementui/index.js"></script>
</head>
<body>
<div id="app">
    <div id="particles-js">
        <form id='login-form' onsubmit="return false">
            <div class="login">
                <div id="login_img"><img src="img/loginLogo.png" alt=""></div>
                <div class="login-top">
                    身份认证
                </div>

                <div class="login-center clearfix">
                    <div class="login-center-img"><img src="img/account.jpg"/></div>
                    <div class="login-center-input">
                        <input type="text" v-model="loginInfo.account" placeholder="请输入您的账号"
                               onfocus="this.placeholder=''"
                               onblur="this.placeholder='请输入您的账号'"/>
                        <div class="login-center-input-text">账号</div>
                    </div>
                </div>

                <div class="login-center clearfix">
                    <div class="login-center-img"><img src="img/phone.png"/></div>
                    <div class="login-center-input">
                        <input v-model="loginInfo.telephone" placeholder="请输入您的手机号" onfocus="this.placeholder=''"
                               onblur="this.placeholder='请输入您的手机号'"/>
                        <div class="login-center-input-text">手机号</div>

                    </div>

                    <div>
                        <input id="validateCodeButton" @click="sendValidateCode()" type="button" style="font-size: 12px"
                               value="获取验证码">
                    </div>

                </div>
                <div class="login-center clearfix">
                    <div class="login-center-img"><img src="img/code.jpg"/></div>
                    <div class="login-center-input">
                        <input type="text" v-model="loginInfo.validateCode" placeholder="请输入您的验证码"
                               onfocus="this.placeholder=''"
                               onblur="this.placeholder='请输入您的验证码'"/>
                        <div class="login-center-input-text">验证码</div>
                    </div>
                </div>
                <div class="login-button"  @click="identify()">
                    <input type="button" id="login_button">提交</input>
                    <br>
                </div>

            </div>

            <div class="sk-rotating-plane"></div>
        </form>
    </div>
</div>

<script>
    var vue = new Vue({
        el: '#app',
        data: {
            loginInfo: {},//登录信息
            User:{

            }
        },
        methods: {
            //发送验证码
            sendValidateCode() {
                var telephone = this.loginInfo.telephone;
                if (!checkTelephone(telephone)) {
                    this.$message.error('请输入正确的手机号');
                    return false;
                }
                validateCodeButton = $("#validateCodeButton")[0];
                clock = window.setInterval(doLoop, 1000); //一秒执行一次
                axios.post("/validatecode/send4ResetPassword.do?telephone=" + telephone).then((response) => {
                    if (!response.data.flag) {
                        //验证码发送失败
                        this.$message.error('验证码发送失败，请检查手机号输入是否正确');
                    }
                });
            },

            //认证
            identify() {

                var telephone = this.loginInfo.telephone;
                 if (!checkTelephone(telephone)) {
                     this.$message.error('请输入正确的手机号');
                     return false;
                 }
                axios.post("/resetpassword/identify.do",this.loginInfo).then((response) => {
                    if(response.data.flag){

                        var param = response.data.data.username;

                        window.location.href="resetpassword.html?username="+param;
                        //验证成功,跳转到修改密码页面
                    }else{
                        //失败，提示失败信息
                        this.$message.error(response.data.message);
                    }
                });
            }
        }
    });
</script>

<!-- scripts -->
<script src="js/particles.min.js"></script>
<script src="js/app.js"></script>
<script type="text/javascript">

</script>
</body>
</html>